package com.example.tobisfirstapp;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends Activity {

	public final static String EXTRA_MESSAGE ="com.example.tobisfirstapp.MESSAGE";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button startMosaic = (Button) findViewById(R.id.start_mosaic);
        startMosaic.setOnClickListener(new Button.OnClickListener(){

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(MainActivity.this,SelectImageActivity.class);
				startActivity(intent);
			}
        	
        });
        //jump directly to mosaic functionality
        startMosaic.performClick();
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main_activity_actions, menu);
        // return super.onCreateOptionsMenu(menu);
        return true;
    }
    
    public void sendMessage(View view){
    	Intent intent = new Intent(this,DisplayMessageActivity.class);
    	EditText editText = (EditText) findViewById(R.id.edit_message);
    	String message = editText.getText().toString();
    	intent.putExtra(EXTRA_MESSAGE,message);
    	startActivity(intent);
    }
    
    public boolean onOptionsItemSelected(MenuItem item){
    	return new ActionBar().handleActionClick(this, item);
    	
    }
    
 
 
    
    
    public void startGame(View view){
    	Intent intent = new Intent(this,GameActivity.class);
    	startActivity(intent);
    }
    
    public void startDice(View view){
    	Intent intent = new Intent(this,DiceActivity.class);
    	startActivity(intent);
    }
}
